package com.aizuda.boot.modules.business.feishu.service;

import com.aizuda.bpm.engine.core.FlowCreator;
import com.aizuda.bpm.engine.core.enums.InstanceEventType;
import com.aizuda.bpm.engine.core.enums.TaskEventType;
import com.aizuda.bpm.engine.entity.FlwHisInstance;
import com.aizuda.bpm.engine.entity.FlwTask;
import com.aizuda.bpm.engine.entity.FlwTaskActor;

import java.util.List;
import java.util.function.Supplier;

/**
 * @Author sangyirong
 * @ClassName FeiShuApprovalService
 * @Version 1.0
 * @Date 2025/8/2 17:32
 */
public interface FeiShuApprovalService {

    /**
     * 创建流程定义时在飞书审批创建流程定义
     *
     * @param processId
     * @return
     */
    Boolean createProcess(Long processId, FlowCreator flowCreator);


    /**
     * 发起流程
     *
     * @param instanceId
     * @return
     */
    Boolean launchProcess(Long instanceId);


    /**
     * 同步任务
     *
     * @param eventType
     * @param supplier
     * @param taskActors
     * @param flowCreator
     * @return
     */
    Boolean syncTask(TaskEventType eventType, Supplier<FlwTask> supplier, List<FlwTaskActor> taskActors, FlowCreator flowCreator,Integer count);


    /**
     * 终止审批
     *
     * @param eventType
     * @param supplier
     * @param flowCreator
     */
    void terminateApproval(InstanceEventType eventType, Supplier<FlwHisInstance> supplier, FlowCreator flowCreator);

    /**
     * 发送飞书审批bot
     *
     * @param eventType
     * @param supplier
     * @param taskActors
     * @param flowCreator
     */
    void sendApprovalBot(TaskEventType eventType, Supplier<FlwTask> supplier, List<FlwTaskActor> taskActors, FlowCreator flowCreator);


    /**
     * 同步飞书审批bot
     *
     * @param taskId
     * @param eventType
     * @param flowCreator
     */
    void syncApprovalBot(Long taskId, TaskEventType eventType,FlowCreator flowCreator);
}
